home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 September / PCWorld_2006-09_cd.bin / v cisle / samurize / samurize_1.64.exe / plugins / hello_world.dpr < prev    next >
Text File  |  2004-03-12  |  986b  |  44 lines

  1. library hello_world;
  2.  
  3. //Procedure that is given control over some objects to define the DLL usage and functions
  4. function Init():PChar;stdcall;
  5. begin
  6. Result:= 'helloworld';
  7. end;
  8.  
  9.  
  10.  
  11. //Procedure to Init the parameters of a function
  12. Function getparam(func: PChar):PChar;stdcall;
  13. begin
  14. if func = 'helloworld' then begin
  15. Result := '';
  16. end;
  17. end;
  18.  
  19.  
  20.  
  21. function helloworld:PChar;stdcall;
  22. var
  23.   final: string;
  24. begin
  25.     //ok if your function returns a var it must be done like that
  26.     //unlike the ini where you directly type the text you want to be returned,
  27.     //it will not work for string vars or even if you do Result:= Pchar(...)
  28.     //so be sure to alloc then copy it will work fine
  29.  
  30.     final :='Hello World from a Delphi DLL!';
  31.     Result := Pchar(final);
  32.  
  33. end; 
  34.  
  35. exports Init name 'init';
  36. exports getparam name 'getparam';
  37. exports helloworld name 'helloworld';
  38. //here the exports names must match the ones you sended to samurize
  39. begin
  40.  
  41. end.
  42.  
  43.  
  44.